import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import actions from './actions'
import mutations from './mutations'
import * as getters from './getters'
import common from './modules/common'
import approval from './modules/approval'

Vue.use(Vuex)

// 只开发环境打印日志，测试与生产环境不打印
const debug = process.env.NODE_ENV === 'development'

export default new Vuex.Store({
  getters,
  actions,
  mutations,
  modules: {
    common,
    approval
  },
  strict: debug,
  plugins: debug ? [createLogger()] : []
})
